import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [{
    path: "/",
    redirect: "/home",
  },
  {
    path: '/list',
    name: 'list',
    component: () => import('../views/list.vue')
  },

  {
    path: '/shopcar',
    name: 'shopcar',
    component: () => import('../views/shopcar.vue')
  }, {
    path: '/xiang',
    name: 'xiang',
    component: () => import('../views/xiang.vue')
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/Home.vue')
  }, {
    path: '/login',
    name: 'login',
    component: () => import('../views/login.vue')
  },{
    path: '/my',
    name: 'my',
    component: () => import('../views/my.vue')
  },
]

const router = new VueRouter({
  routes,
});


const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  if (typeof location == 'string') {
    var Separator = '&'
    if (location.indexOf('?') == -1) {
      Separator = '?'
    }
    location = location + Separator + 'random=' + Math.random()
  }
  return routerPush.call(this, location).catch((error) => error)

}
export default router;